@extends('admin.layout-adm')
@section('title','修改密码')
@section('content')
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" >
            <div class="col-md-12" id="content" >
                <div class="app_content_div" id="app_content_div_301Index">
                    <h3>重置密码</h3>
                </div>
                <form class="form-horizontal"  method="post" action="/adm/user/edit-user/{{$user->id}}">
                    <input name="_token" type="hidden" value="6rTKCVZh8Eeu8Q17K4m3szIEbuG6XpTEC51EanhK">
                    <input type="hidden" name="id" value="1" />
                    <div class="form-group">
                        <label for="password" class="col-sm-2 control-label"><span style="color:red;">*</span>输入新密码</label>
                        <div class="col-sm-10">
                            <input type="password" class="form-control" style="width:300px;" id="password" name="password" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="password_confirmation" class="col-sm-2 control-label"><span style="color:red;">*</span>确认密码</label>
                        <div class="col-sm-10">
                            <input type="password" class="form-control" style="width:300px;" id="password_confirmation" name="password_confirmation" >
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <input name="dosubmit" type="button" value="提交" class="btn_p" onclick="check()">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <script>
            function check(){
                var password=$("#password").val();
                var password_confirmation=$("#password_confirmation").val();
                var _token="{{csrf_token()}}";
                $.post('/adm/user/edit-user/{{$user->id}}',
                    {'password':password,'password_confirmation':password_confirmation,'_token':_token},
                    function (data){
                        if(data.success){
                            alert("修改成功");
                            location.href='/adm/user';
                        }
                        else {
                            alert(data.msg);
                        }
                    }
                    ,'json');
            }
        </script>
@endsection
